home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Code Resources / Jims CDEFs 1.50 / CDEF Source / source / cdefVSlider.h < prev    next >
Encoding:
Text File  |  1995-11-13  |  2.7 KB  |  65 lines  |  [TEXT/KAHL]

  1. //------------------------- © 1994-1995 by James G. Stout ---------------------------
  2. //    File    : cdefVSlider.h
  3. //    Date    : April 6, 1994
  4. //    Author    : Jim Stout
  5. //            :
  6. //    Purpose    : A slider CDEF modeled after the one in the Sound Control panel
  7. //            : 4 variation codes are supported (see below).
  8. //            :
  9. //            : This control has some non-standard behaviors.
  10. //            :
  11. //            : 1. It has a semi-fixed size (does not scale like a scrollbar).
  12. //            : 2. Specify the size in 'units' for the control by passing
  13. //            :        a number between 2 & 20 in the control refCon.  It will
  14. //            :        default to 7 (as in the Sound Control panel).
  15. //            : 3. The control rect should be 42 wide and 21 + (12 * units) high
  16. //            :        or it will be clipped when drawn.
  17. //            : 4. Control Min & Max will be filled in for you.
  18. //            :        Min = 0
  19. //            :        Max = 12 * units (84 for default size)
  20. //            : 5. There is no control title.
  21. //            :
  22. //            : If you find a use for this, I'd love to know about it.  Bug reports
  23. //            : are always interesting.
  24. //            :
  25. //            : Internet    : JimS@WRQ.COM(work hours, PST)
  26. //            : AppleLink   : WRQ            (daily)
  27. //            : CompuServe  : 73240,2052    (weekly or so)
  28. //            : AOL         : JasG        (weekly or so)
  29. //            : eWorld      : Jim Stout    (weekly or so)
  30. //----------------------------------------------------------------------------------
  31.  
  32. //----------------------------------------------------------------------------------
  33. // Variation codes
  34. //----------------------------------------------------------------------------------
  35.  
  36. #define scaleNoFill      0x0001    // no gray pattern inside scale
  37. #define ctl3D            0x0002    // 3D effect
  38. #define thumbNoSnap        0x0004    // don't snap thumb to scale values
  39. #define scaleBlank        0x0008    // don't show scale values
  40.  
  41. //----------------------------------------------------------------------------------
  42. // CDEF private data structure    
  43. //----------------------------------------------------------------------------------
  44.  
  45. typedef struct {
  46. CGrafPtr    offPort;
  47. Rect        scaleRect;
  48. short        scaleSize;
  49. short        pDepth;
  50. short        qdVers;
  51. }CDEFData,**CDEFHandle;
  52.  
  53. //----------------------------------------------------------------------------------
  54. //    Function prototypes
  55. //----------------------------------------------------------------------------------
  56.  
  57. static void doInit            (ControlHandle theControl);
  58. static void doDisp            (ControlHandle theControl);
  59. static long doTest            (ControlHandle theControl, short varCode, long param);
  60. static void dragThumb        (ControlHandle theControl, short varCode, long param);
  61. static void scaleClick        (ControlHandle theControl, short varCode, short partCode);
  62. static void getThumbRect    (ControlHandle theControl, Rect * rThumb, Rect * rScale);
  63. static Boolean    drawParts    (ControlHandle theControl, short varCode, Rect * rThumb);
  64. static void doDraw            (ControlHandle theControl, short varCode);
  65.